package com.beidouin.sensortest;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class AboutUsActivity extends AppCompatActivity {
    public static final String APPLICATION_BEIDOUIN = "com.beidouin.sensortest";
    public static final String APPLICATION_HUACE = "com.huace.sensortest";
    public static final String APPLICATION_BEIDI = "com.beidi.sensortest";


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_about_us);

        if (APPLICATION_BEIDOUIN.equals(BuildConfig.APPLICATION_ID)) {
            setContentView(R.layout.activity_about_beidouin);
            TextView email;
            TextView website;
            website = (TextView) findViewById(R.id.website);

            email = (TextView) findViewById(R.id.E_mail);

            website.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent it = new Intent();
                    it.setAction(Intent.ACTION_VIEW);
                    it.setData(Uri.parse("http://www.beidouin.com"));
                    startActivity(it);
                }
            });
            email.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent it = new Intent(Intent.ACTION_VIEW);
                    it.setData(Uri.parse("mailto:support@beidouin.com"));
                    it.putExtra(Intent.EXTRA_SUBJECT, "body=传感器套装开发演示平台：");
                    startActivity(it);
                }
            });
        } else if (APPLICATION_HUACE.equals(BuildConfig.APPLICATION_ID)) {
            setContentView(R.layout.activity_about_huace);
            TextView website_huace;
            website_huace = (TextView) findViewById(R.id.website_huace);
            website_huace.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent it = new Intent();
                    it.setAction(Intent.ACTION_VIEW);
                    it.setData(Uri.parse("http://www.huace.cn"));
                    startActivity(it);
                }
            });

        } else if (APPLICATION_BEIDI.equals(BuildConfig.APPLICATION_ID)) {
            setContentView(R.layout.activity_about_beidi);
            TextView website_beidi;
            website_beidi = (TextView) findViewById(R.id.website_beidi);
            website_beidi.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent it = new Intent();
                    it.setAction(Intent.ACTION_VIEW);
                    it.setData(Uri.parse("http://www.beidedu.com.cn"));
                    startActivity(it);
                }
            });
        }
    }
}
